#include <vector>
#include <string>
#include <fstream>
#include <iostream>
#include "src/hostspot/src/share/vm/classfile/BootClassLoad.h"
#include "src/hostspot/src/share/vm/classfile/ClassFileParser.h"
#include "src/hostspot/src/share/vm/oops/ConstantPool.h"
#include "src/hostspot/src/share/tool/DataTranslate.h"
#include "stdlib.h"
#include "src/hostspot/src/share/vm/prims/JavaNativeInterface.h"
#include "src/hostspot/src/share/vm/runtime//JavaThread.h"
#include "float.h"
#include<iostream>
#include<string.h>
#include "src/hostspot/src/share/vm/utilties/BasicType.h"
#include "src/hostspot/src/share/vm/runtime/StackValue.h"
#include "src/hostspot/src/share/vm/runtime/StackValueCollection.h"
#include "stack"
#include "src/hostspot/src/share/vm/utilties/Base.h"
#include "thread"

//typedef union double_ToLong{
//    double db;
//    long ll;
//};
//
//long doubleToLong( double value ){
//    double_ToLong d1;
//    d1.db = value;
//    return d1.ll;
//}
//
//double LongToDouble( long value ){
//    double_ToLong d1;
//    d1.ll = value;
//    return d1.db;
//}
//int intb2l(int b)
//{
//    return (b << 24 & 0xff000000) | (b << 8 & 0x00ff0000) | (b >> 24 & 0x000000ff) | (b >> 8 & 0x0000ff00);
//}



using namespace std;

void startJVM(){
    BootClassLoad* bootClassLoad = new BootClassLoad;
    InstanceKlass* in = bootClassLoad -> loadKlass("A");

    JavaNativeInterface* v = new JavaNativeInterface ;
    MethodInfo* mi = v->getMethodID(in,"main","([Ljava/lang/String;)V");

    //创建线程
    JavaThread* javaThread = new JavaThread;



}
//
//typedef union FloatToInt{
//    float f;
//    int i;
//    char* c ;
//} FTI ;

typedef union DoubleToInt{
    long l;
    double d;
};

union {
    double jd;
    int    array[2];
} x;

//得到double转换int之后 前byte四位的值

void beforeInt(double value){

    x.jd = value;



//    DoubleToInt MY;
//    int a =DTI.l << 32; // 0
//    int b =DTI.l >> 32; // 1...128
//
//
//
//    //将两个int 转换回去
//    long la = a;
//    long lb = b;
//    MY.d = 0;
//
//    printf("MY  %f  \n" , MY.d );


}


int main() {

    list<thread> l;




//    stack<StackValue*> container;
//    StackValue* sv = new StackValue(1,2);
//    container.push(sv);

//    printf(" %f " , ff );

    printf(" 何时与君逢 , 无期 , 愿佳节时刻!  \n");
    //    startJVM();

//    BasicType* bt;

//    StackValueCollection* svc = new StackValueCollection(2) ;
//    double d = 32.0;
//    svc->pushDouble(d);
////    StackValue* sv = svc->pop();
//    double dd = svc->popDouble();
//    printf(" dd %f \n" , dd );


//    double b = svc->popDouble();
//    printf(" %f " , b );



//    long i = 3;
//    printf(" %d " , i << 8 );



//    stack<int> sck;
//    sck.push(1);
//    sck.push(2);
//    sck.push(3);
////    sck.pop();
//    printf(" %d \n" , sck.top() );
//    printf(" %d \n" , sck.size() );






//        short s = 2 ;
//        short t = 4;
//        int it= s << 16 | t;
//        printf("%d \n",it);
//
//        short st = it >> 16;
//        printf( " short  %d \n",st);
//        short  sst = it << 16 >> 16 ;
//        printf( " sst  %d \n",sst);



//      DataTranslate* cfp = new DataTranslate;
//      float f = 2.2;
//      long l = cfp->floatToLong(f);
//      printf(" long %d \n" , l);
//      float ft = cfp->longToFloat(l);
//      printf(" float %f \n" , ft );
//
//      double d = 3.3;
//      long ll = cfp->doubleToLong(d);
//      printf(" long %d \n",ll);
//      double dd = cfp->longToDouble(ll);
//      printf( " double %f \n " , dd );
//
//    FILE* fp=fopen("/home/longyunbo/temp/parse/A.class","r");
//    unsigned int magic;
//    fread(&magic, sizeof(magic), 1, fp);
//    magic = _d->smallToBigEnd(magic);
//    printf("魔数：%#x\n", magic);



//    ConstantPool* cp = new ConstantPool;
//    cp ->
//    cp->set_length(10);



//    double d = 8.8;
//
//    long l = 10;
//
//    long ll = doubleToLong(d);
//
//    double dd = LongToDouble(ll);
//
//    printf(" double -> %f \n", dd );
//
//    printf("%d",sizeof(long));


    return 0;
}
